fix: stop SMGC service on SR detach to prevent orphaned systemd units - #92
Merged
Merged
Conversation
Wescoeur
requested changes
Aug 19, 2025
Comment on lines
+4055
to
+4066
| def stop_gc_service(sr_uuid): | ||
| """ | ||
| Stops the templated systemd service which runs GC on the given SR UUID. | ||
| """ | ||
| sr_uuid_esc = sr_uuid.replace("-", "\\x2d") | ||
| util.SMlog(f"Stopping SMGC@{sr_uuid}...") | ||
| cmd = ["/usr/bin/systemctl", "--quiet", "stop", f"SMGC@{sr_uuid_esc}"] | ||
| try: | ||
| subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, check=True) | ||
| except subprocess.CalledProcessError as e: | ||
| util.SMlog(f"Failed to stop gc service `SMGC@{sr_uuid_esc}`: `{e.stderr.decode().strip()}`") | ||
|
|
Member
There was a problem hiding this comment.
I think it's cleaner to use util.doexec and compact the common code with start_gc_service.
Millefeuille42
force-pushed
the
mlr-970-cleanup-SMGC-units
branch
from
August 20, 2025 10:46
f2d41c7 to
4b1d2d9
Compare
Wescoeur
reviewed
Aug 21, 2025
Comment on lines
+4041
to
+4044
| cmd=[ "/usr/bin/systemctl", "--quiet" ] | ||
| if extra_args: | ||
| cmd.extend(extra_args) | ||
| cmd += [action, f"SMGC@{sr_uuid_esc}"] |
Member
There was a problem hiding this comment.
Small difference in using arrays with and without spaces.
Member
|
Before merge, it would be great to open a PR on the upstream side. |
Author
|
Opened PR on upstream: xapi-project#770 |
Millefeuille42
force-pushed
the
mlr-970-cleanup-SMGC-units
branch
2 times, most recently
from
August 21, 2025 15:31
23aaeb6 to
3c9feba
Compare
Wescoeur
force-pushed
the
3.2.12-8.3
branch
3 times, most recently
from
August 28, 2025 15:32
e7801da to
ca5b52d
Compare
Millefeuille42
force-pushed
the
mlr-970-cleanup-SMGC-units
branch
from
September 1, 2025 15:04
3c9feba to
e2d8514
Compare
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Millefeuille42
force-pushed
the
mlr-970-cleanup-SMGC-units
branch
from
September 22, 2025 13:02
e2d8514 to
7af8b28
Compare
Author
|
Upstream PR have been merged. Are we good to merge this one ? |
Wescoeur
approved these changes
Oct 2, 2025
Member
|
@Nambrok Can you validate on your side? |
Nambrok
approved these changes
Oct 3, 2025
Wescoeur
pushed a commit
that referenced
this pull request
Dec 1, 2025
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Dec 1, 2025
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Dec 1, 2025
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Dec 9, 2025
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Dec 9, 2025
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Millefeuille42
added a commit
that referenced
this pull request
Dec 10, 2025
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Feb 2, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Feb 3, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Feb 3, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Feb 3, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
May 19, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
May 19, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Jun 25, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Jun 25, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Jun 25, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Jun 25, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
Wescoeur
pushed a commit
that referenced
this pull request
Jun 25, 2026
This is not done on every and each implementation of SR but only on ones that calls cleanup.start_gc_service (like FileSR) and on the classes that inherits from them and don't call super on detach. This is to prevent useless errors logs like Failed to stop xxx.service: Unit xxx.service not loaded. Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is not done on every and each implementation of SR but only on ones that calls
cleanup.start_gc_service(likeFileSR) and on the classes that inherits from them and don't call super ondetach(likeCephFSSR).This is to prevent useless errors logs like
Failed to stop xxx.service: Unit xxx.service not loaded.